<template>
    <!-- pages/goods/goods.wxml -->
    <view class="goods-list">
        <view class="goods" @tap="goDetail" :id="item.product_id" :data-id="item.product_id" v-for="(item, index) in list" :key="item.product_id">
            <image class="img" :src="'http://1.14.101.56:82/'+item.product_picture" mode="acpectFill"></image>

            <text>{{ item.product_name }}</text>

            <text style="color: red">\n ￥{{ item.product_selling_price }}</text>
        </view>
    </view>
</template>

<script>
	// const db = wx.cloud.database();
// pages/goods/goods.js
export default {
    data() {
        return {
            list: {}
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
	 //1.14.101.56:28/peroduct/getpromoproduct
	onLoad() {
		uni.request({
			url:"/api/product/getPromoProduct",
			method:"POST",
			data:{"categoryName":"包装礼盒"},
		  success: res => {
			  console.log(res)
		      this.list=res.data.Product
		  },
		  fail: res => {
		    console.log("查询失败", res)
		  }
		})
		 
    },
    methods: {
        goDetail(e) {
            uni.navigateTo({
                url: '/pages/goodsdetail/goodsdetail?id=' + e
            });
        }
    }
};
</script>
<style>
/* pages/goods/goods.wxss */
.goods-list {
    display: flex;
    flex-wrap: wrap;
	background-color: #ef9b9b;
    /* flex-direction: column; */
}
.goods-title {
    width: 100%;
    font-size: 15px;
    font-weight: bold;
    padding-left: 10rpx;
}
.goods {
    background-color: #fff;
    border-radius: 10%;
    left: -12rpx;
    /* border: 1px solid #ccc; */
    width: 49%;
    font-size: 14px;
    margin: 2rpx;
    text-align: center;
}
.img {
    border-radius: 10%;
    width: 100%;
    height: 300rpx;
}
</style>
